package com.study.bigwork.entity;
//错题本


import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@Entity
@Table(name="wrongquestion")
public class WrongQuestion {
	private int id;//id
	private int wrong_id;//错题id
	private int user_id;//用户id
	private String question_Type;//错题类型
	private String update_time;//上传时间
	private List<String> homework_image;//作业图片
	private List<String> result_image;//结果图片
	private List<String> result_image_teacher;
	private String result_text_teacher;//老师注释
	private String result_text_student;//学生注释
	
	private String result_image_teacher1;
	private String homework_image1;
	
	private String result_image1;
	
	
	@Id
	@GeneratedValue(generator="increment_generator")
	@GenericGenerator(name="increment_generator",strategy="increment")
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Transient
	public List<String> getResult_image_teacher() {
		return result_image_teacher;
	}
	public void setResult_image_teacher() {
		System.out.println("result_image_teacher:"+result_image_teacher);
		Gson gson=new Gson();
		List<String> list=gson.fromJson(result_image_teacher1, new TypeToken<ArrayList<String>>() {
		}.getType());
		this.result_image_teacher = list;
	}
	@Column(name="result_image_teacher")
	public String getResult_image_teacher1() {
		return result_image_teacher1;
	}
	public void setResult_image_teacher1(String result_image_teacher1) {
		this.result_image_teacher1 = result_image_teacher1;
	}

	@Column(name="wrong_id")
	public int getWrong_id() {
		return wrong_id;
	}
	public void setWrong_id(int wrong_id) {
		this.wrong_id = wrong_id;
	}
	@Column(name="user_id")
	public int getUser_id() {
		return user_id;
	}
	public void setUser_id(int user_id) {
		this.user_id = user_id;
	}
	@Column(name="update_time")
	public String getUpdate_time() {
		return update_time;
	}
	public void setUpdate_time(String update_time) {
		this.update_time = update_time;
	}
	@Transient
	public List<String> getHomework_image() {
		return homework_image;
	}
	public void setHomework_image() {
		System.out.println("homework_image");
		Gson gson=new Gson();
		List<String> list=gson.fromJson(this.homework_image1, new TypeToken<ArrayList<String>>() {
		}.getType());
		this.homework_image = list;
	}
	@Transient
	public List<String> getResult_image() {
		return result_image;
	}
	public void setResult_image() {
		System.out.println("result_image:"+result_image1);
		Gson gson=new Gson();
		List<String> list=gson.fromJson(result_image1, new TypeToken<ArrayList<String>>() {
		}.getType());
		this.result_image = list;
	}
	@Column(name="question_Type")
	public String getQuestion_Type() {
		return question_Type;
	}
	public void setQuestion_Type(String question_Type) {
		this.question_Type = question_Type;
	}
	@Column(name="result_text_teacher")
	public String getResult_text_teacher() {
		return result_text_teacher;
	}
	public void setResult_text_teacher(String result_text_teacher) {
		this.result_text_teacher = result_text_teacher;
	}
	@Column(name="result_text_student")
	public String getResult_text_student() {
		return result_text_student;
	}
	public void setResult_text_student(String result_text_student) {
		this.result_text_student = result_text_student;
	}
	@Column(name="homework_image")
	public String getHomework_image1() {
		return homework_image1;
	}
	public void setHomework_image1(String homework_image1) {
		this.homework_image1 = homework_image1;
	}
	@Column(name="result_image")
	public String getResult_image1() {
		return result_image1;
	}
	public void setResult_image1(String result_image1) {
		this.result_image1 = result_image1;
	}
	
	
	
	
	
	
	
	
	
	@Override
	public String toString() {
		return "WrongQuestion [id=" + id + ", wrong_id=" + wrong_id + ", user_id=" + user_id + ", question_Type="
				+ question_Type + ", update_time=" + update_time + ", homework_image=" + homework_image
				+ ", result_image=" + result_image + ", result_text_teacher=" + result_text_teacher
				+ ", result_text_student=" + result_text_student + ", homework_image1=" + homework_image1
				+ ", result_image1=" + result_image1 + "]";
	}
	public WrongQuestion(int id, int wrong_id, int user_id, String question_Type, String update_time,
			List<String> homework_image, List<String> result_image, String result_text_teacher,
			String result_text_student, String homework_image1, String result_image1) {
		super();
		this.id = id;
		this.wrong_id = wrong_id;
		this.user_id = user_id;
		this.question_Type = question_Type;
		this.update_time = update_time;
		this.homework_image = homework_image;
		this.result_image = result_image;
		this.result_text_teacher = result_text_teacher;
		this.result_text_student = result_text_student;
		this.homework_image1 = homework_image1;
		this.result_image1 = result_image1;
	}
	public WrongQuestion(int id, int wrong_id, int user_id, String question_Type, String update_time,
			List<String> homework_image, List<String> result_image, String result_text_teacher,
			String result_text_student) {
		super();
		this.id = id;
		this.wrong_id = wrong_id;
		this.user_id = user_id;
		this.question_Type = question_Type;
		this.update_time = update_time;
		this.homework_image = homework_image;
		this.result_image = result_image;
		this.result_text_teacher = result_text_teacher;
		this.result_text_student = result_text_student;
	}
	public WrongQuestion() {
		super();
	}
	
	
	
	
	
	
	
	

}
